<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">

    </div>

    
    <script>
        //生成一个h2元素
        const h2Ele = document.createElement('h2') // <h2></h2>
        h2Ele.innerHTML = "helloworld"

        // 挂载h2到 div
        const divEle = document.querySelector('#app')
        divEle.appendChild(h2Ele)

        
        
    </script>
</body>
</html>